﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using nERP.Model;
using nERP.Model.So;
using nERP.Model.Bas;
using nERP.Model.Wms;

namespace nERP.Model.So
{
    /// <summary>
    /// 销售退货明细
    /// </summary>
	[Table("SaleReturnDetail")]
    [SoftKey(nameof(SaleReturnDetail.SaleReturnDetailCode))]
    [Display(Name = "_Model.SaleReturnDetail")]
    public class SaleReturnDetail : BasePoco,ITenant
    {
        [Display(Name = "_Model._SaleReturnDetail._Seq")]
        [Comment("序号")]
        public int? Seq { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._SaleReturn")]
        [Comment("销售退货")]
        [NotMapped]
        public SaleReturn SaleReturn { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._SaleReturn")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("销售退货")]
        public string SaleReturnId { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._SaleReturnDetailCode")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("退货明细单号")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [CanNotEdit]
        public string SaleReturnDetailCode { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._Goods")]
        [Comment("商品")]
        [NotMapped]
        public Goods Goods { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._Goods")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [Comment("商品")]
        public string GoodsId { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._GoodsName")]
        [StringLength(64, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("商品名称")]
        public string GoodsName { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._GoodsSpec")]
        [StringLength(64, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("商品规格")]
        public string GoodsSpec { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._GoodsUnit")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("计量单位")]
        public string GoodsUnit { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._ReturnNumber")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [Comment("退货数量")]
        public decimal? ReturnNumber { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._UnitPrice")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [Comment("退货单价")]
        public decimal? UnitPrice { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._DiscountPrice")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [Comment("折扣金额")]
        public decimal? DiscountPrice { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._TotalPrice")]
        [Comment("退货金额")]
        public decimal? TotalPrice { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._TaxRate")]
        [Comment("税率")]
        public decimal? TaxRate { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._TaxUnitPrice")]
        [Comment("含税单价")]
        public decimal? TaxUnitPrice { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._TotalTaxPrice")]
        [Comment("含税金额")]
        public decimal? TotalTaxPrice { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._Status")]
        [Comment("状态")]
        public dStatusTypeEnum? Status { get; set; } = dStatusTypeEnum.Unaudited;
        [Display(Name = "_Model._SaleReturnDetail._Remark")]
        [StringLength(256, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("备注")]
        public string Remark { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._Sale")]
        [Comment("销售订单")]
        [NotMapped]
        public Sale Sale { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._Sale")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("销售订单")]
        public string SaleId { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._TaxPrice")]
        [Comment("税额")]
        public decimal? TaxPrice { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._SaleDetail")]
        [Comment("销售明细")]
        [NotMapped]
        public SaleDetail SaleDetail { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._SaleDetail")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("销售明细")]
        public string SaleDetailId { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._SaleOutWarehouseDetail")]
        [Comment("销售出库明细")]
        [NotMapped]
        public SaleOutWarehouseDetail SaleOutWarehouseDetail { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._SaleOutWarehouseDetail")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("销售出库明细")]
        public string SaleOutWarehouseDetailId { get; set; }
        [Display(Name = "_Model._SaleReturnInWarehouseDetail._SaleReturnDetail")]
        [InverseProperty("SaleReturnDetail")]
        [NotMapped]
        [SoftFK(nameof(nERP.Model.Wms.SaleReturnInWarehouseDetail.SaleReturnDetailId))]
        public List<SaleReturnInWarehouseDetail> SaleReturnInWarehouseDetail_SaleReturnDetail { get; set; }
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
